<template>
	<view class="container">
		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
			<!--  -->
			<user-hebavior-item v-for="item in list" :key="item.user.user_id" :item="item" type="hello"></user-hebavior-item></mescroll-body>
	</view>
</template>

<script>
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js';
import userHebaviorItem from '../components/custom/user-hebavior-item.vue';
export default {
	mixins: [MescrollMixin], // 使用mixin
	components: { userHebaviorItem },
	data() {
		return {
			list: []
		};
	},
	methods: {
		upCallback(mescroll) {
			this.$u.api.helloList(mescroll.num).then(res => {
				if (mescroll.num == 1) {
					this.setHelloRead();
					this.list = res.data.list.data;
				} else {
					this.list.push(res.data.list.data);
				}
				this.mescroll.endBySize(res.data.list.data.length, res.data.list.total);
			});
		},
		setHelloRead() {
			this.$u.api.readHello();
		}
	}
};
</script>

<style></style>
